﻿using Lufei_CaterDAL;
using Lufei_CaterModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lufei_CaterBLL
{
    public class DeskInfoBLL
    {


        DeskInfoDAL dal = new DeskInfoDAL();

        /// <summary>
        /// 查询所有没有被删除的房间信息  RoomID
        /// </summary>
        /// <param name="rooID"></param>
        /// <returns></returns>
        public List<DeskInfo> GetDesksByRoomID(int roomID)
        {
            return dal.GetDesksByRoomID(roomID);

        }


        /// <summary>
        /// 根据餐桌id修改餐桌的属性
        /// </summary>
        /// <param name="deskstate"></param>
        /// <param name="deskid"></param>
        /// <returns></returns>
        public bool UpdateDeskStateByID(int deskstate, int deskid)
        {
            return dal.UpdateDeskStateByID(deskstate, deskid) > 0;
        }


        /// <summary>
        /// 查询所有没有被删除的桌子
        /// </summary>
        /// <param name="rooID"></param>
        /// <returns></returns>
        public List<DeskInfo> GetDesks()
        {
            return dal.GetDesks();
        }

        /// <summary>
        /// 根据id删除数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteDeskByID(int id)
        {
            return dal.DeleteDeskByID(id)>0;
        }



        /// <summary>
        /// 添加桌子
        /// </summary>
        /// <param name="di"></param>
        /// <returns></returns>
        public bool InsertDesk(DeskInfo ri)
        {

            return dal.InsertDesk(ri) > 0;
        }

        /// <summary>
        /// 根据id查询桌子
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeskInfo GetDeskInfoByID(int id)
        {
            return dal.GetDeskInfoByID(id);
        }

        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="ri"></param>
        /// <returns></returns>
        public bool UpdateDeskInfo(DeskInfo ri)
        {
          return  dal.UpdateDeskInfo(ri)>0;
        }
    }

}
